<!DOCTYPE html>
<html>
<head>
    <title>登录 - Templet360</title>
    {include file="index/header"}
    <link rel="stylesheet" href="/template/default/public/css/user.css">
    <div class="tpt-wp cl">
        <div class="tpt-login cl">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">登录</li>
                    <li><a href="/user/reg.html" class="jie-title">注册</a></li>
                </ul>
                <div class="layui-tab-content">
                    <form class="layui-form layui-form-pane" method="post" style="padding: 10px 0 0 0;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">登录邮箱</label>
                            <div class="layui-input-inline">
                                <input type="text" name="usermail" required lay-verify="required|email|emails|emailss"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">登录密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" required lay-verify="required|pass"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        {if condition="config('web.WEB_YAN') eq 1"}
                        <div class="layui-form-item">
                            <label class="layui-form-label">验证码</label>
                            <div class="layui-input-inline">
                                <input type="text" name="code" required lay-verify="required" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="" style="float: left;margin-bottom: 20px;">
                            <img src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();"
                                 style="float:left; cursor:pointer;" alt="captcha"/>
                        </div>
                        {/if}
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="login_index">立即登录</button>
                        </div>
                    </form>
                    {if condition="config('web.WEB_LOG') eq 3"}或者使用QQ账号登录<a class="login" href="javascript:void(0)"><i
                        class="iconfont"
                        style="font-size: 20px;margin-left: 8px;position: relative;top: 2px;color: #7CA9C9;">&#xe613;</i>{/if}
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        layui.use('form', function () {
            var form = layui.form,
                jq = layui.jquery;

            form.verify({
                emails: function (value) {
                    if (value.length < 10) {
                        return '邮箱必须大于10位';
                    }
                }
                , emailss: function (value) {
                    if (value.length > 32) {
                        return '邮箱必须小于32位';
                    }
                }
                , pass: [/(.+){6,12}$/, '密码必须6到12位']
                , content: function (value) {
                    layedit.sync(editIndex);
                }
            });
            form.on('submit(login_index)', function (data) {
                loading = layer.load(2, {
                    shade: [0.2, '#000']
                });
                var param = data.field;
                jq.post('{:url("index/login/index")}', param, function (data) {
                    if (data.code == 200) {
                        layer.close(loading);
                        layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                            location.href = '/';
                        });
                    } else {
                        layer.close(loading);
                        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                    }
                });
                return false;
            });
        })
    </script>
    {include file="index/footer"}
    </body>
</html>